#define _CRT_SECURE_NO_WARNINGS
int* productExceptSelf(int* nums, int numsSize, int* returnSize)
{
    int i = 0;
    int* left = malloc(sizeof(int) * numsSize);
    int* right = malloc(sizeof(int) * numsSize);
    left[0] = 1;
    for (i = 1; i < numsSize; i++)
    {
        left[i] = left[i - 1] * nums[i - 1];
    }
    right[numsSize - 1] = 1;
    for (i = numsSize - 2; i >= 0; i--)
    {
        right[i] = right[i + 1] * nums[i + 1];
    }
    int* answer = malloc(sizeof(int) * numsSize);
    for (i = 0; i < numsSize; i++)
    {
        answer[i] = left[i] * right[i];
    }
    *returnSize = numsSize;
    return answer;
}